 package com.ysd.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.ysd.dao.impl.FishClassifyDaoImpl;
import com.ysd.dao.impl.MoHuDaoImpl;
import com.ysd.entity.Details;
import com.ysd.entity.FishClassify;


public class ChaXunServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//引入产品分类实现类
		FishClassifyDaoImpl fishDao = new FishClassifyDaoImpl();
		List<FishClassify> fishClassifyList = fishDao.getFish();
		request.setAttribute("fishClassifyList", fishClassifyList);
		
		//模糊查询
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html");
		HttpSession session = request.getSession();
		
		String sosuo = request.getParameter("sosuo");
		MoHuDaoImpl chaxun = new MoHuDaoImpl();
		ArrayList<Details> mohuchaxun = chaxun.getMoHu(sosuo);
		System.out.println(sosuo);
		request.setAttribute("mhcx", mohuchaxun);
		session.setAttribute("mhcx", mohuchaxun);
		request.getRequestDispatcher("NewFile.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
